<?php
    include('header.php');
    include('submenu.php');
    
    $sql = 'SELECT * FROM media_slide WHERE ms_id='.$_GET['ms_id'];
    $result = $db->Execute($sql);
    if($result->RecordCount()>0){
        
	if($m_id!=3){
	    if(img_exists(APPPATH.'/images/media/'.$m_id,$result->fields['ms_path'])){
		$img = '<img src="'.SITEURL.'/images/media/'.$m_id.'/'.$result->fields['ms_path'].'" /><input type="hidden" name="img_old" value="'.$result->fields['ms_path'].'" /><br />';
	    }else{
		$img = '<input type="hidden" name="img_old" value="" />';
	    }
	    
	    $imgFiled =<<<xxx
		<p>รูป : </p>
		<p class="guideline">ขนาด 700x450 pixel</p>
		{$img}
		<input type="file" name="news_img" class="input large" />
xxx;
    }else{
        $imgFiled =<<<xxx
            <p>Youtube Url : </p>
            <input type="text" name="news_img" class="input large" value="{$result->fields['ms_path']}" />
xxx;
    }
?>
    <div class="grid_18" id="contents">
        
        <div id="contents_">
            <form action="?m=media-communications&s=slide-edit_query&m_id=<?php echo $m_id; ?>" method="post" enctype="multipart/form-data">
	    <input type="hidden" name="h_m_id" value="<?php echo $m_id; ?>" />
	    <input type="hidden" name="ms_id" value="<?php echo $_GET['ms_id']; ?>" />
            <div id="about_us_company_msg_1_th" class="form_field">
                <?php echo $imgFiled; ?>
            </div>
            <div id="about_us_company_msg_1_th" class="form_field">
                <p>ข้อความ (en) : </p>
                <textarea name="text_en" class="styled_textarea" style="height:50px;"><?php echo $result->fields['ms_text_en']; ?></textarea>
            </div>
            <div id="about_us_company_msg_1_th" class="form_field">
                <p>ข้อความ (th) : </p>
                <textarea name="text_th" class="styled_textarea" style="height:50px;"><?php echo $result->fields['ms_text_th']; ?></textarea>
            </div>
            
            <div id="about_us_company_msg_2_en" class="form_field">
		<input type="hidden" name="ms_id" value="<?php echo $result->fields['ms_id']; ?>" />
                <button class="button">SAVE</button>
                <!--<div class="button" onclick="window.location='?m=services&s=packing-dyntecdisc-product'">CANCEL</div>-->
            </div>
            </form>
        </div>
        
    </div><!-- end .grid_18 -->
    <div class="clear">&nbsp;</div>
<?php
    }else{
?>
    <div class="grid_18" id="contents">
        <div id="query_result">
        <?php
            echo 'ไม่มีข้อมูล <img src="images/ajax-loader.gif" />';
            redirect('?m=media-communications&m_id='.$m_id,3);
        ?>
        </div>
    </div><!-- end .grid_18 -->
    <div class="clear">&nbsp;</div>
<?php
    }
    include('footer.php');
?>